package com.ryskoo.common.constant;

/**
 * 订单状态
 *
 * @author Monster
 * 1待支付
 * 2待发货
 *  3部分发货 
 *  4已发货 
 *  5交易成功 
 *  6交易关闭 
 *
 */
public enum OrderStatusEnum {
	WAITPAY(1, "待支付"),
	WAITSHIP(2, "待发货"),
	SHIPPING(3, "部分发货"),
	SHIPED(4, "已发货"),
	ORDERSUCCESS(5, "交易成功"),
    CANCELED(6, "交易关闭");
    private int value;
    private String name;

    OrderStatusEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByValue(int value) {
        for (OrderStatusEnum ose : OrderStatusEnum.values()) {
            if (ose.getValue() == value) {
                return ose.getName();
            }
        }
        return "";
    }
}
